<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>pelican 在Windows环境下的安装配置</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Zendwind">

    <!-- Le styles -->
    <link rel="stylesheet" href="../../../../theme/css/bootstrap.min.css" type="text/css" />
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
      .tag-1 {
        font-size: 13pt;
      }
      .tag-2 {
        font-size: 10pt;
      }
      .tag-2 {
        font-size: 8pt;
      }
      .tag-4 {
        font-size: 6pt;
     }
    </style>
    <link href="../../../../theme/css/bootstrap-responsive.min.css" rel="stylesheet">
        <link href="../../../../theme/css/font-awesome.css" rel="stylesheet">

    <link href="../../../../theme/css/pygments.css" rel="stylesheet">

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../../../../theme/images/favicon.ico">
    <link rel="apple-touch-icon" href="../../../../theme/images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="../../../../theme/images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="../../../../theme/images/apple-touch-icon-114x114.png">

    <link href="../../../../" type="application/atom+xml" rel="alternate" title="ZendWind ATOM Feed" />
    <link href="../../../../feeds/all.rss.xml" type="application/atom+xml" rel="alternate" title="ZendWind RSS Feed" />

  </head>

  <body>

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="../../../../index.html">ZendWind </a>
          <div class="nav-collapse">
            <ul class="nav">
                  <li><a href="http://www.zendwind.com"><font color="#58ACFA">主页</font></a></li>
                  <li><a href="http://www.zendwind.com/category/c.html"><font color="#58ACFA">C/C++</font></a></li>
                  <li><a href="http://www.zendwind.com"><font color="#58ACFA">Linux</font></a></li>
                  <li><a href="http://www.zendwind.com/category/python.html"><font color="#58ACFA">Python</font></a></li>
                  <li><a href="http://www.zendwind.com/feeds/all.atom.xml"><font color="#58ACFA">Feed</font></a></li>
                  <li><a href="http://www.zendwind.com"><font color="#58ACFA">生活杂谈</font></a></li>
                  <li><a href="http://www.zendwind.com/category/about.html"><font color="#58ACFA">About</font></a></li>
                          <li class="divider-vertical"></li>
		    </ul>
            <!--<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>-->
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container-fluid">
      <div class="row">
        <div class="span9" id="content">
<section id="content">
        <article>
                <header>
                        <h1>
                                <a href=""
                                        rel="bookmark"
                                        title="Permalink to pelican 在Windows环境下的安装配置">
                                        pelican 在Windows环境下的安装配置
                                </a>
                        </h1>
                </header>
                <div class="entry-content">
                <div class="well">
<footer class="post-info">
<span class="label">Date</span>
<abbr class="published" title="2013-11-26T00:00:00">
        <i class="icon-calendar"></i>周二 26 十一月 2013
</abbr>
<span class="label">By</span>
<a href="../../../../author/zendwind.html"><i class="icon-user"></i>Zendwind</a>
<!--
<span class="label">Category</span>
<a href="../../../../category/python.html"><i class="icon-folder-open"></i>Python</a>.
-->

<span class="label">Tags</span>
	<a href="../../../../tag/pelican.html"><i class="icon-tag"></i>pelican</a>
</footer><!-- /.post-info -->                </div>
                <h2>Pelican 在Windows环境下的安装及配置</h2>
<p><strong>前言</strong></p>
<p>此篇博客主要为Pelican的配置安装所写，在此过程中主要参考资料<a href="http://www.yanyulin.info/pages/2013/11/pelican.html">烟雨林博客</a>、<a href="http://blog.csdn.net/poem_of_sunshine/article/details/12913325">poem_of_sunshine</a>和<a href="http://frantic1048.com/bo-ke-dan-sheng-ji-ji-yu-githubpelicanchuang-jian-bo-ke-de-zheng-ge-guo-cheng.html">frantic1048</a>，他们写得都很好，内容流程完善，但在具体实施过程中小白还是会遇到很多问题，因此本文结合现有的教程，再进一步指出整个操作过程中所可能遇到的问题，也为自己留个纪念。 </p>
<p><strong>本文架构</strong></p>
<p>本文将从以下几个方面进行描述：</p>
<ul>
<li><a href="#install_env">安装环境</a><ul>
<li><a href="#env_win">windows安装环境</a></li>
<li><a href="#soft_install">安装软件系列</a></li>
</ul>
</li>
<li><a href="#install_step">安装步骤</a><ul>
<li><a href="#install_python">python安装</a></li>
<li><a href="#install_setuptools">setuptools安装</a></li>
<li><a href="#install_pip">pip安装</a></li>
<li><a href="#install_git">Git Bash安装</a></li>
<li><a href="#install_pelican">pelican安装</a></li>
<li><a href="#install_markdownpad">markdownpad2安装</a></li>
<li><a href="#install_make">make安装</a></li>
</ul>
</li>
<li><a href="#config_pelican">Pelican配置</a><ul>
<li><a href="#config_git">远程仓库配置</a></li>
<li><a href="#config_regular">常规配置</a></li>
<li><a href="#config_special">进阶配置</a></li>
</ul>
</li>
<li><a href="#blog_write">Markdown博客编写</a></li>
<li><a href="#error_correct">安装配置出错问题集绵</a><ul>
<li><a href="#error_setuptools">setuptools问题</a></li>
<li><a href="#error_pelican">pelican握手超时问题</a></li>
<li><a href="#error_git">git pull&amp;push问题</a></li>
<li><a href="#error_makefile">Makefile问题</a></li>
<li><a href="#error_code_red">code block红框问题</a></li>
</ul>
</li>
<li><a href="#summary">总结</a></li>
</ul>
<h2 id="install_env">安装环境</h2>

<h3 id="env_win">Windows安装环境</h3>

<p>本文基于Windows7 32位操作系统
<h3 id="soft_install">安装软件系列</h3>
在整个安装配置过程中，所需要的软件清单如下所示,点击相应软件可直接从网站下载。</p>
<ul>
<li><a href="http://wwww.python.org/download/"><em>python2.7</em></a></li>
<li><a href="http://e.pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe#md5=57e1e64f6b7c7f1d2eddfc9746bbaf20"><em>setuptools</em></a></li>
<li><a href="http://e.pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz#md5=6afbb46aeb48abac658d4df742bff714"><em>pip</em></a></li>
<li><a href="http://msysgit.googlecode.com/files/Git-1.8.4-preview20130916.exe"><em>Git</em></a></li>
<li><a href="http://e.pypi.python.org/packages/source/p/pelican/pelican-3.3.tar.gz#md5=0e1c16a13290e19e02b739ad7a9b3850"><em>Pelican</em></a></li>
<li><a href="http://markdownpad.com/download/markdownpad2-setup.exe"><em>markdownpad2</em></a></li>
<li>
<p><a href="http://pan.baidu.com/s/1GepXz"><em>make</em></a>
<h2 id="install_step">安装步骤</h2>
<h3 id="install_python">Python安装</h3>
进官网下载python2.7 Windows安装版本，我用的是python2.7.6，msi类型，直接点击安装文件进行安装，安装路径自己选，安装好之后，将安装路径加入到系统环境变量PATH中,例如我安装的路径如下：</p>
<p>C:\Program Files\Python27\</p>
</li>
</ul>
<h3 id="install_setuptools">setuptools安装</h3>

<p>安装此插件的主要目的当然就是为了大名鼎鼎的easy_install了撒，它与pip齐名，呆会也要装起。在我用<code>python setup.py install</code>过程中，一开始出现了编码错误问题，python的默认编码为ascii，有网上资料说改Python的默认编码为utf-8就可以，即在出现编码错误的文件中执行如下语句：</p>
<div class="highlight"><pre><span class="n">import</span> <span class="n">sys</span>
<span class="n">reload</span><span class="p">(</span><span class="n">sys</span><span class="p">)</span>
<span class="n">sys</span><span class="p">.</span><span class="n">setdefaultencoding</span><span class="p">(</span><span class="s">&quot;utf8&quot;</span><span class="p">)</span>
</pre></div>


<p>但这方法在我的系统中无效，最后解决方法是下载.exe类型的setuptools进行安装，下载地址如上软件清单链接,此过程中安装很顺利。安装好后在python安装目录下的Scripts文件夹会有一些关于easy_install的文件，所以要将此路径加到系统环境变量PATH，我的路径如下:</p>
<div class="highlight"><pre><span class="p">{</span><span class="n">python</span> <span class="n">install</span> <span class="n">path</span><span class="p">}</span><span class="o">/</span><span class="n">scripts</span><span class="o">/</span>
</pre></div>


<h3 id="install_pip">Pip安装</h3>

<p>pip我是直接用easy_install安装的，安装命令: <code>easy_install pip</code>
。安装好之后也会在Scripts文件夹生成一些Pip的可执行文件。
<h3 id="install_git">Git Bash安装</h3>
Git 客户端的安装，直接选择默认安装就行了,Git版本不能太低。
<h3 id="install_pelican"></h3>
Pelican是用PIP安装的，一开始安装时也出现一些错误，就是PIP默认使用国外镜像，在获取安装源过程中会出现握手超时现象，即镜像不稳定，后来查相关资料找到国内清华大学的镜像安装源，其网址如下：</p>
<div class="highlight"><pre><span class="nl">http:</span><span class="c1">//e.pypi.python.org/simple/</span>
</pre></div>


<p>在Pip安装时指定此路径即可，速度搜搜的，很爽很稳定，指定格式如下：</p>
<div class="highlight"><pre><span class="n">pip</span> <span class="n">install</span> <span class="n">pelican</span> <span class="o">-</span><span class="n">i</span> <span class="n">http</span><span class="o">:</span><span class="c1">//e.pypi.python.org/simple/</span>
</pre></div>


<p>安装其它相关python包时也可以这样安装，速度有保证。
<h3 id="install_markdownpad">Markdownpad2安装</h3>
此软件是Window下比较好的Markdown编辑器，不过是收费的，为了满足大家的使用需求，对于我等穷屌丝只能找些破解软件用用，所以在网上找了相关的破解文件，请点击此<a href="http://pan.baidu.com/s/1b2HBK">下载</a>。破解方法已经在下载的文件包中有所说明，这里也提一下，分两步：</p>
<p>首先，将user.config放在如下格式路径中：</p>
<div class="highlight"><pre><span class="c">%LOCALAPPDATA%\MarkdownPad2\MarkdownPad2.exe_Url_bakzl5xvna20knbzwksj2a0nyzlicvaa\2.3.2.34663\</span>
<span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">:</span> <span class="n">c</span><span class="p">:</span><span class="o">\</span><span class="n">users</span><span class="o">\</span><span class="p">{</span><span class="n">username</span><span class="p">}</span><span class="o">\</span><span class="n">AppData</span><span class="o">\</span><span class="n">Local</span><span class="o">\</span><span class="n">MarkdownPad2</span><span class="p">.</span><span class="n">exe_Url_2o2l2qlnbxt2ueyxs3lr3txdmzazbghc</span><span class="o">\</span><span class="mf">2.3</span><span class="p">.</span><span class="mf">2.34664</span><span class="o">\</span>
</pre></div>


<p>其次，运行下Patch.exe注册机程序，Patch下安装主目录中的Markdownpad2程序即可。<em>注：运行此patch之前务必不要先启动Markdownpad2程序</em></p>
<p>最后，启动Markdownpad2即可享受专业版的服务了。
<h3 id="install_make">Make 安装</h3>
下载完Make后，直接放到一个文件夹，将此路径添加到系统环境变量PATH中，重启或注销电脑后就可以进行make操作了
<h2 id="config_pelican">Pelican配置</h2>
配置Pelican，首先需要新建一个BLOG目录，然后执行<code>pelican-quickstart</code>,具体步骤如下：</p>
<div class="highlight"><pre><span class="n">mkdir</span> <span class="n">blog</span>
<span class="n">cd</span> <span class="n">blog</span>
<span class="n">pelican</span><span class="o">-</span><span class="n">quickstart</span>
</pre></div>


<p>在执行完<code>pelican-quickstart</code>后，在blog目录会产生如下目录结构的文件：</p>
<div class="highlight"><pre><span class="n">blog</span><span class="o">/</span>
<span class="o">|--</span><span class="n">content</span> <span class="err">#存储所写的</span><span class="n">blog</span><span class="err">文件目录，</span>
<span class="o">|</span>   <span class="err">└──（</span><span class="n">blog</span> <span class="n">pages</span><span class="p">)</span> <span class="err">#博客文件，如</span><span class="o">*</span><span class="p">.</span><span class="n">md</span><span class="err">后缀的文件</span>
<span class="o">|--</span><span class="n">output</span> <span class="err">#执行</span><span class="n">make</span> <span class="n">publish</span><span class="err">之后，会将博客文件转换成相应的</span><span class="n">html</span><span class="err">文件及相应的存储目录</span>
<span class="o">|</span>   <span class="err">└──</span><span class="p">.</span><span class="n">git</span> <span class="err">#执行</span><span class="n">git</span> <span class="n">init</span><span class="err">之后，产生的远程仓库目录</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">author</span> <span class="err">#作者目录，存放</span><span class="n">pelicanconf</span><span class="p">.</span><span class="n">py</span><span class="err">中指定的</span><span class="n">Author</span><span class="err">文件</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">category</span> <span class="err">#分类目录，默认目录文件为</span><span class="n">misc</span><span class="err">，在编辑器中指定</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">feeds</span> <span class="err">#目录，</span><span class="n">pelicanconf</span><span class="p">.</span><span class="n">py</span><span class="err">中</span><span class="n">FEED_RSS</span><span class="err">指定的</span><span class="n">XML</span><span class="err">文件</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">pages</span> <span class="err">#目录，</span><span class="n">pelicanconf</span><span class="p">.</span><span class="n">py</span><span class="err">中</span><span class="n">ARTICLE_URL</span><span class="err">指定格式分类文件</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">tag</span> <span class="err">#目录，存放编辑器开头所指定的</span><span class="n">Tag</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">theme</span> <span class="err">#目录，存放博客模板文件</span>
<span class="o">|</span>   <span class="err">└──</span><span class="n">archives</span><span class="p">.</span><span class="n">html</span><span class="p">,</span><span class="n">authors</span><span class="p">.</span><span class="n">html</span><span class="p">,</span><span class="n">categories</span><span class="p">.</span><span class="n">html</span><span class="p">,</span><span class="n">index</span><span class="p">.</span><span class="n">html</span><span class="p">,</span> <span class="n">tags</span><span class="p">.</span><span class="n">html</span>
<span class="o">|</span><span class="err">——</span><span class="n">pelican</span><span class="o">-</span><span class="n">plugins</span> <span class="err">#目录，</span><span class="n">pelican</span><span class="err">插件</span>
<span class="o">|</span><span class="err">——</span><span class="n">develop_server</span><span class="p">.</span><span class="n">sh</span> <span class="err">#</span><span class="n">pelican</span><span class="err">简易</span><span class="n">web</span><span class="err">服务器操作文件</span>
<span class="o">|</span><span class="err">——</span><span class="n">fabfile</span><span class="p">.</span><span class="n">py</span> <span class="err">#</span> <span class="err">与</span><span class="n">make</span><span class="err">类似，可用</span><span class="n">fab</span> <span class="n">publish</span><span class="p">,</span> <span class="n">fab</span> <span class="n">server</span><span class="err">命令</span>
<span class="o">|</span><span class="err">——</span><span class="n">Makefile</span> <span class="err">#</span><span class="n">make</span> <span class="err">命令文件</span>
<span class="o">|</span><span class="err">——</span><span class="n">pelicanconf</span><span class="p">.</span><span class="n">py</span> <span class="err">#主要的</span><span class="n">pelican</span><span class="err">配置文件</span>
<span class="o">|</span><span class="err">——</span><span class="n">publishconf</span><span class="p">.</span><span class="n">py</span> <span class="err">#发布配置文件</span><span class="p">,</span><span class="err">可有可无</span>
</pre></div>


<h3 id="config_git">Git远程仓库配置</h3>

<p>要将blog部署到git上，必须在本地建立一个git仓库，同时必须确保在github server端有远程仓库，名字一般为<code>username.github.io</code>。本地操作命令如下：</p>
<div class="highlight"><pre><span class="n">cd</span> <span class="n">output</span>
<span class="n">git</span> <span class="n">init</span>  <span class="err">#产生一个</span><span class="p">.</span><span class="n">git</span><span class="err">文件夹</span>
<span class="n">git</span> <span class="n">remote</span> <span class="n">add</span> <span class="n">origin</span> <span class="n">https</span><span class="o">:</span><span class="c1">//github.com/username.github.io.git#将远程仓库配置到本地</span>
</pre></div>


<h3 id="config_regular">Pelican常规配置</h3>

<p>对于Pelican常规配置，主要配置选项如下，具体说明可参考<a href="http://docs.getpelican.com/en/3.2/settings.html">getpelican</a>网站的命令说明。</p>
<div class="highlight"><pre><span class="n">Author</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>
<span class="n">SITENAME</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>
<span class="n">SITEURL</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>
<span class="n">GITHUB_URL</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>
<span class="n">ARCHIVES_URL</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>
<span class="n">ARTICLE_URL</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>
<span class="n">ARTICLE_SAVE_AS</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;&quot;</span>

<span class="n">DEFAULT_LANG</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;zh&quot;</span><span class="err">#默认语言设置</span>
<span class="n">DATE_FORMAT</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;zh&quot;</span><span class="o">:</span><span class="p">(</span><span class="s">&quot;zh_CN&quot;</span><span class="p">,</span><span class="s">&quot;%Y-%m-%d,%a&quot;</span><span class="p">),}</span><span class="err">#日期格式设置，可按自己喜好设定</span>
<span class="n">DEFAULT_PAGINATION</span><span class="o">=</span><span class="mi">5</span> <span class="err">#默认的分页数量</span>
<span class="n">TIME_ZONE</span> <span class="o">=</span> <span class="n">u</span><span class="s">&quot;Asia/Shanghai&quot;</span><span class="err">#时区设置</span>
</pre></div>


<h3 id="config_special">Pelican进阶配置</h3>

<p>一些进阶设置可以帮助更好的管理blog，比如用到Google的Analytical，第三方的Disqus评论系统，还有Feed、插件、Blogroll及Social设置，如果还想要导航菜单项，还可设置<code>MENUITEMS</code>等，下面一一介绍：</p>
<p><strong>Feed设置</strong></p>
<p>Feed的设置方便博客的订阅，在pelicanconf.py中需添加如下命令:</p>
<div class="highlight"><pre><span class="n">FEED_RSS</span> <span class="o">=</span> <span class="n">u</span><span class="s">&quot;feeds/all.rss.xml&quot;</span> 
<span class="n">CATEGORY_FEED_RSS</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;feeds/%s.rss.xml&quot;</span><span class="err">#为分类添加</span><span class="n">Feed</span>
</pre></div>


<p><strong>Plugin设置</strong></p>
<p>可以根据需要添加相应的插件，插件可从github克隆，克隆命令如下：</p>
<div class="highlight"><pre><span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="o">:</span><span class="c1">//github.com/getpelican/pelican-plugins.git</span>
</pre></div>


<p>比如要设置Sitemap插件，然后在pelicanconf.py中设置如下：</p>
<div class="highlight"><pre><span class="n">PLUGIN_PATH</span><span class="o">=</span><span class="n">u</span><span class="s">&quot;pelican-plugins&quot;</span>
<span class="n">PLUGINS</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;sitemap&quot;</span><span class="p">]</span>
<span class="n">SITEMAP</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s">&quot;format&quot;</span><span class="o">:</span><span class="s">&quot;xml&quot;</span><span class="p">,</span>
    <span class="s">&quot;priorities&quot;</span><span class="o">:</span><span class="p">{</span>
        <span class="s">&quot;articles&quot;</span><span class="o">:</span><span class="mf">0.7</span><span class="p">,</span>
        <span class="s">&quot;indexes&quot;</span><span class="o">:</span><span class="mf">0.5</span><span class="p">,</span>
        <span class="s">&quot;pages&quot;</span><span class="o">:</span><span class="mf">0.3</span><span class="p">,</span>
    <span class="p">},</span>
    <span class="s">&quot;changefreqs&quot;</span><span class="o">:</span><span class="p">{</span>
        <span class="s">&quot;articles&quot;</span><span class="o">:</span><span class="s">&quot;monthly&quot;</span><span class="p">,</span>
        <span class="s">&quot;indexes&quot;</span><span class="o">:</span><span class="s">&quot;daily&quot;</span><span class="p">,</span>
        <span class="s">&quot;pages&quot;</span><span class="o">:</span><span class="s">&quot;monthly&quot;</span><span class="p">,</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>


<p><strong>Theme设置</strong></p>
<div class="highlight"><pre><span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="o">:</span><span class="c1">//github.com/getpelican/pelican-themes.git</span>
<span class="n">cd</span> <span class="n">pelican</span><span class="o">-</span><span class="n">themes</span>
<span class="n">pelican</span><span class="o">-</span><span class="n">themes</span> <span class="o">-</span><span class="n">i</span> <span class="n">bootstrap2</span> <span class="err">#可换成你自己的</span><span class="n">theme</span>
</pre></div>


<p><strong>Analytical设置</strong></p>
<p>需要到Google的<a href="http://www.google.cn/intl/zh-CN/analytics/">Analytical</a>申请一个账号，记录下追踪ID，然后在pelicanconf.py中添加如下命令：</p>
<div class="highlight"><pre><span class="n">GOOGLE_ANALYTICS</span> <span class="o">=</span> <span class="n">u</span><span class="s">&quot;UA-********-*&quot;</span> <span class="err">#</span><span class="n">ID</span><span class="err">以</span><span class="n">UA</span><span class="err">开头</span>
</pre></div>


<p><strong>Disqus</strong></p>
<p>第三方评论系统有很多，这里选用很流行的Disqus作为第三方评论系统，同样需要到<a href="http://disqus.com">Disqus</a>官网申请账号，然后填写两处：</p>
<div class="highlight"><pre><span class="n">Site</span> <span class="n">name</span><span class="o">:</span> <span class="p">{</span><span class="n">your</span> <span class="n">git</span> <span class="n">account</span> <span class="n">name</span><span class="p">}.</span><span class="n">github</span><span class="p">.</span><span class="n">io</span>
<span class="n">Admin</span> <span class="n">URL</span><span class="o">:</span> <span class="p">{</span><span class="n">Shortname</span><span class="p">}.</span><span class="n">disqus</span><span class="p">.</span><span class="n">com</span>
</pre></div>


<p>记下Shortname，然后在pelicanconf.py中添加如下命令行：</p>
<div class="highlight"><pre><span class="n">DISQUS_SITENAME</span> <span class="o">=</span> <span class="n">u</span><span class="s">&quot;{Shortname}&quot;</span> <span class="err">#填入你的</span><span class="n">Shortname</span>
</pre></div>


<p><strong>独立域名设置</strong></p>
<p>如果你有独立域名，则可用自己的域名去访问github博客，在godaddy上可用支付宝购买，同时我们用dnspod进行动态域名解析，步骤如下:</p>
<p><em>步骤1</em>：修改godaddy中的NameServers的两个地址为dnspod的DNS地址：</p>
<div class="highlight"><pre><span class="n">f1g1ns1</span><span class="p">.</span><span class="n">dnspod</span><span class="p">.</span><span class="n">net</span>
<span class="n">f1g1ns2</span><span class="p">.</span><span class="n">dnspod</span><span class="p">.</span><span class="n">net</span>
</pre></div>


<p><em>步骤2</em>：在Dnspod中添加一条A记录，指向github URL</p>
<div class="highlight"><pre><span class="mf">207.97.227.245</span>
</pre></div>


<p><em>步骤3</em>：在Pelican主目录，即上面创建的blog/output目录，添加CNAME文件，在文件中添加你的独立域名    </p>
<p><strong>Menu Item设置</strong></p>
<p>在你的博客中，可设置相应的菜单项，菜单项是通过MENUITEMS设置的，具体如下所示：</p>
<div class="highlight"><pre><span class="n">MENUITEMS</span> <span class="o">=</span> <span class="p">((</span><span class="s">&quot;ITEM1&quot;</span><span class="p">,</span><span class="s">&quot;http://github.com&quot;</span><span class="p">),</span>
             <span class="p">(</span><span class="s">&quot;ITEM2&quot;</span><span class="p">,</span><span class="n">URL</span><span class="p">),</span>
            <span class="p">......)</span>
</pre></div>


<p><strong>BlogRoll和Social设置</strong></p>
<p>设置一些Blog链接，通过设置<code>LINKS</code>实现,具体如下：</p>
<div class="highlight"><pre><span class="n">LINKS</span> <span class="o">=</span>  <span class="p">((</span><span class="s">&quot;Github&quot;</span><span class="p">,</span> <span class="s">&quot;https://github.com&quot;</span><span class="p">),</span>
      <span class="p">(</span><span class="s">&quot;Cnblogs&quot;</span><span class="p">,</span> <span class="n">URL</span><span class="p">),)</span>
<span class="n">SOCIAL</span> <span class="o">=</span> <span class="p">((</span><span class="s">&quot;博客园&quot;</span><span class="p">,</span> <span class="s">&quot;http://www.cnblogs.com&quot;</span><span class="p">),</span>
         <span class="p">(</span><span class="s">&quot;Github&#39;,&#39;http://github.com&quot;</span><span class="p">),)</span>
</pre></div>


<p><h2 id="blog_write">Markdown博客编写</h2>
利用Markdownpad编辑器可方便进行Markdown格式的博客编写，编写格式如下所示：</p>
<div class="highlight"><pre><span class="n">Date</span><span class="o">:</span> <span class="mi">2013</span><span class="o">-</span><span class="mi">11</span><span class="o">-</span><span class="mi">27</span>
<span class="n">Title</span><span class="o">:</span> <span class="n">pelican</span> <span class="n">install</span>
<span class="n">Tags</span><span class="o">:</span> <span class="n">pelican</span>
<span class="n">Category</span><span class="o">:</span> <span class="n">Pelican</span>
<span class="n">Slug</span><span class="o">:</span> <span class="n">pelican</span><span class="o">-</span><span class="n">install</span>
<span class="err">【</span><span class="n">blog</span><span class="err">正文内容】</span>
</pre></div>


<p>在编好之后，执行如下命令：</p>
<div class="highlight"><pre><span class="n">make</span> <span class="n">publish</span> <span class="err">#</span> <span class="err">将</span><span class="p">.</span><span class="n">md</span><span class="err">发布到</span><span class="n">output</span><span class="err">目录</span>
<span class="n">make</span> <span class="n">server</span> <span class="err">#</span> <span class="err">在本机查看预览博客，</span><span class="n">localhost</span><span class="o">:</span><span class="mi">8000</span>
</pre></div>


<p>如果要一次性部署到github,可以配置Makefile文件中的github，要修改两处，一处是将<code>$(PUBLISHDIR)</code>替换成<code>$(CONFFILE)</code>,另一处增加一些git命令，具体如下所示：</p>
<div class="highlight"><pre><span class="nl">publish:</span>
<span class="err">$</span><span class="p">(</span><span class="n">PELICAN</span><span class="p">)</span> <span class="err">$</span><span class="p">(</span><span class="n">INPUTDIR</span><span class="p">)</span> <span class="o">-</span><span class="n">o</span> <span class="err">$</span><span class="p">(</span><span class="n">OUTPUTDIR</span><span class="p">)</span> <span class="o">-</span><span class="n">s</span> <span class="err">$</span><span class="p">(</span><span class="n">CONFFILE</span><span class="p">)</span> <span class="err">$</span><span class="p">(</span><span class="n">PELICANOPTS</span><span class="p">)</span>
<span class="nl">github:</span> <span class="n">publish</span>
    <span class="n">cd</span> <span class="err">$</span><span class="p">(</span><span class="n">OUTPUTDIR</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">git</span> <span class="n">add</span> <span class="p">.</span> <span class="p">;</span> 
    <span class="n">cd</span> <span class="err">$</span><span class="p">(</span><span class="n">OUTPUTDIR</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">git</span> <span class="n">pull</span> <span class="n">origin</span> <span class="n">master</span><span class="p">;</span>
    <span class="n">cd</span> <span class="err">$</span><span class="p">(</span><span class="n">OUTPUTDIR</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">git</span> <span class="n">commit</span> <span class="o">-</span><span class="n">m</span> <span class="err">&#39;</span><span class="n">commit</span><span class="err">&#39;</span><span class="p">;</span>
    <span class="n">cd</span> <span class="err">$</span><span class="p">(</span><span class="n">OUTPUTDIR</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">git</span> <span class="n">push</span> <span class="n">origin</span> <span class="n">master</span>
</pre></div>


<p>最后，只要进行<code>Makefile</code>的同级目录，执行<code>make github</code>即可完成一次性部署。<em>注：在此过程中，可能要输入github username 和 password，要避免重复输入，请查看我的</em><a href="http://www.zendwind.com/pages/2013/11/27/git_push_non_user_pwd.html"><em>另一篇博客</em></a>。</p>
<h2 id="error_correct">安装配置出错问题集绵</h2>

<p>在安装过程中，出现一些错误，在此统一写出来，以留个纪念
<h3 id="error_setuptools">Setuptools问题</h3>
此问题在上述有所提到，就是用<code>python setup.py install</code>安装时提示编码出错，最后重新下载.exe文件安装解决此问题，编码本身暂时还未找到有效解决方法。
<h3 id="error_pelican">Pelican握手超时问题</h3>
此问题上述也有所提及，就是国外镜像不稳定导致，换成清华镜像后就好了
<h3 id="error_git">Git pull &amp; push问题</h3>
在Git pull和Git push过程中出现如下图所示问题：</p>
<p><img alt="" src="http://i.imgur.com/we4TGRU.png" /></p>
<p>即以https进行git操作时，会出现libcurl库不支持https的错误，此错误主要是由于现有libcurl库不支持ssl所致，解决方法是下载支持ssl的<a href="http://pan.baidu.com/s/1gO7m">libcurl</a>,然后将相应的.dll文件拷贝到c:\windows\system32中即可。
<h3 id="error_makefile">Makefile问题</h3>
此问题主要是由于自己粗心大意造成，但也贴出来以免大家也犯同样的错误，其实也很简单，就是忘记将<code>publish</code>项的$(PUBLISHDIR)替换成$(CONFFILE)了，后果就是.git文件夹被破坏。
<h3 id="error_code_red">Code block 红框问题</h3>
在提交blog时，markdown语法中的code块对中文出现红框问题，主要是因为因为Pelican是使用pygment处理代码高亮的，而pygment的高亮颜色定义就在当前使用的主题目录中的pygment.css这个文件里，要修改代码高亮的配色就要通过修改这个文件来实现。现在打开它，可以看到里面是对代码的各种类型的内容的风格定义，其中有一行如下：</p>
<div class="highlight"><pre><span class="p">.</span><span class="n">highlight</span> <span class="p">.</span><span class="n">err</span> <span class="p">{</span> <span class="n">border</span><span class="o">:</span> <span class="mi">1</span><span class="n">px</span> <span class="n">solid</span> <span class="err">#</span><span class="n">FF0000</span> <span class="p">}</span> <span class="o">/</span> <span class="n">Error</span> <span class="o">/</span>
</pre></div>


<p>根据内容可以看出这是规定书写错误的代码的文本样式，可是平时代码中有的字符也会被识别成错误的代码,所以就造成了代码块中时不时出现恼人的红框的问题，原因清楚了，现在要解决它就很容易了，直接删掉那行中的border样式就可以了。如果你跟我一样完全不需要给这类代码规定特殊样式的话，直接删掉那行即可。
<h2 id="summary">总结</h2>
写了几个小时，终于把这篇博文写完了，主要是对markdown语法还不了解，边学边写，好得完成了，还有些部分是对pelican主页进行布置，这块自己也没有很多经验，以后会逐步深入，希望此篇blog能对初学者有所帮助。</p>
                </div><!-- /.entry-content -->
        </article>
</section>
        </div><!--/span-->
		
        <div class="span3 well sidebar-nav" id="sidebar">
<ul class="nav nav-list">
<li class="nav-header"><h4>分类目录</h4></li>
<hr color=#987cb9 SIZE=3 />
<li>
	<a href="../../../../category/about.html">
		About
	</a>	
</li>
<li>
	<a href="../../../../category/git.html">
		GIT
	</a>	
</li>
<li>
	<a href="../../../../category/python.html">
		Python
	</a>	
</li>

<li class="nav-header"><h4>标签云</h4></li>
<hr color=#987cb9 SIZE=3 />
<a href="../../../../tag/pygame.html">
        pygame&nbsp;&nbsp;
</a>
<a href="../../../../tag/eclipse.html">
        eclipse&nbsp;&nbsp;
</a>
<a href="../../../../tag/pelican.html">
        pelican&nbsp;&nbsp;
</a>
<a href="../../../../tag/django.html">
        Django&nbsp;&nbsp;
</a>
<a href="../../../../tag/push.html">
        push&nbsp;&nbsp;
</a>
<a href="../../../../tag/about.html">
        about&nbsp;&nbsp;
</a>
<a href="../../../../tag/git.html">
        git&nbsp;&nbsp;
</a>
<br />
<br />
<li class="nav-header"><h4>友情链接</h4></li>
<hr color=#987cb9 SIZE=3 />
    <li><a href="http://bbs.chinaunix.net/forum.php?gid=277" target=_blank>ChinaUnix运维专栏</a></li>
    <li><a href="http://bbs.linuxtone.org/forum.php" target=_blank>LinuxTone运维专栏</a></li>
    <li><a href="http://wiki.saltstack.cn/" target=_blank>SaltStack维基-自动化运维</a></li>
    <li><a href="http://www.huxiu.com/" target=_blank>虎嗅网-商业资讯与交流平台</a></li>
    <li><a href="http://www.36kr.com/" target=_blank>36氪-互联网创业</a></li>


</ul>        </div><!--/.well -->
		<!--add by zendwind-->
		<div class="span9" id="content">
			<hr size=2>
<!-- Baidu Button BEGIN -->
<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">

<a class="bds_qzone"></a>
<a class="bds_tsina"></a>
<a class="bds_tqq"></a>
<a class="bds_renren"></a>
<a class="bds_t163"></a>
<span class="bds_more"></span>
</div>
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=0" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->		</div>
		
		<div class="span9" id="content">
			<hr size=2>

<!-- Duoshuo Comment BEGIN -->
<div class="ds-thread"></div>
<script type="text/javascript">
var duoshuoQuery = {short_name:"zendwind"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = 'http://static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		|| document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
<!-- Duoshuo Comment END -->		</div>
		 
      </div><!--/row-->
	   
      <hr>

      <footer>
        <address id="about">
        <<center>Power by Pelican, Copyright@ <a href="http://www.zendwind.com">ZendWind</a></center>
        </address><!-- /#about -->
		<p><center> @ZendWind Personal Blog </center></p>
      </footer>

    </div><!--/.fluid-container-->


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
	var pageTracker = _gat._getTracker("UA-46020847-1");
pageTracker._trackPageview();
} catch(err) {}</script>
	

    <!-- Le javascript -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../../../../theme/js/jquery-1.7.2.min.js"></script>
    <script src="../../../../theme/js/bootstrap.min.js"></script>
  </body>
</html>